define([
    "ngController"
],function (appAngular) {

    // 底部按钮先关-可拖动模块-11、分解
    appAngular.directive("bimApiModelResolve", function () {
        return {
            restrict: "EA",
            replace: true,
            template: `<div class="draggable model-resolve" ng-if="btnsSelect.name=='resolve'&&btnsSelect.check == true">
						<div class="resolve-header">
							<h3>分解</h3>
							<img ng-src="{{baseUrl + imgDragClose}}" ng-click="modelDragTitleClose()">
						</div>
						<div class="resolve-content">
							<div class="resolve-every">
								<span>分解:</span>
								<input class="switch-btn switch-btn-animbg" type="checkbox" ng-model="modelResolve.switch">
							</div>
							<div class="resolve-every">
								<span>X轴:</span>
								<input type="range" min="-100" max="100" step="10" 
								ng-model="modelResolve.x" ng-change="slideXYZ()">
								<span>{{modelResolve.x}}</span>
							</div>
							<div class="resolve-every">
								<span>Y轴:</span>
								<input type="range" min="0" max="100" step="10" 
								ng-model="modelResolve.y" ng-change="slideXYZ()">
								<span>{{modelResolve.y}}</span>
							</div>
							<div class="resolve-every">
								<span>Z轴:</span>
								<input type="range" min="-100" max="100" step="10" 
								ng-model="modelResolve.z" ng-change="slideXYZ()">
								<span>{{modelResolve.z}}</span>
							</div>
						</div>
						<div class="resolve-btn">
							<button ng-click="modelResolveReset()">重置</button>
						</div>
					</div>`,
            link: function ($scope, $elem, attrs) {
                // 模型中-11-分解属性
                $scope.modelResolve = {
                    switch: false,
                    x: '0',
                    y: '0',
                    z: '0'
                };

                // watch
                // 模型11、分解
                $scope.$watch("modelResolve.switch", function (newValue, oldValue) {
                    newValue == true ? Model.dismantle() : Model.redismantle();
                    // 模型分解
                    // Model.dismantle()
                    // 分解还原
                    // Model.redismantle()
                });
            }
        };
    });

    return appAngular;
});